using System;
using Schedulr.Helpers;
using Schedulr.Tools;
using Schedulr.Configuration;

namespace Schedulr
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            try
            {
                if (args.Length > 0 && string.Equals(args[0], "/upload", StringComparison.OrdinalIgnoreCase))
                {
                    FlickrServer.UploadNextPictureBatchInQueue();
                    SchedulrConfiguration.Instance.Save();
                }
                else
                {
                    GuardedApplication.Run<MainForm>();
                }
            }
            catch (Exception exc)
            {
                Logger.Log("An unexpected exception occurred", exc);
            }
        }
    }
}